import {createStyles, Theme, withStyles} from "@material-ui/core/styles";
import {WithStyles} from "@material-ui/core/styles/withStyles";
import {Card, List} from 'antd';
import * as React from 'react';
import {CardStyle} from '../../component/largeCard';
import {info} from "../../type/CommonData";
import { Link } from "react-router-dom";


const styles=(theme:Theme)=>
    createStyles({
        root:CardStyle,
        newText: {
            "flex": "1",
            whiteSpace:"nowrap",
            overflow:"hidden",
            textOverflow:"ellipsis"

        },
        newDate:{
            "width":"160px",

        }
    });


interface IProps extends WithStyles<typeof styles>{
    data:info[]
}


class InfoPublic extends React.Component<IProps>{

    public render(){
        const {classes} =this.props;
        return(
            // 对应的css
            <div >
                <Card
                    title="信息公开"
                    extra={<Link to={"/information-disclosure"} style={{fontSize:"10px"}}>更多>></Link>}
                    style={{width:"100%",overflow:"hidden"}}
                    className={classes.root}
                ><List size="small"
                       itemLayout="horizontal"
                       dataSource={this.props.data}
                          renderItem={(item: info) => (
                              <List.Item  style={{padding:"3px", paddingLeft:0,border: 0}}>
                                      <div  className={classes.newText}>
                                          {item.remark}
                                      </div>
                                      <div  className={classes.newDate}>
                                          {item.updateTime}
                                      </div>
                              </List.Item>
                          )}
                    />
                </Card>
            </div>
        );
    }
}
// 导出模板中的组件
export default withStyles(styles)(InfoPublic)
